/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.rm.entidades;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * 
 * @author ffbeltran
 */
@Entity
@Table(name = "exp_viaje")
@NamedQueries( {
		@NamedQuery(name = "ExpViaje.findAll", query = "SELECT e FROM ExpViaje e"),
		@NamedQuery(name = "ExpViaje.findById", query = "SELECT e FROM ExpViaje e WHERE e.id = :id"),
		@NamedQuery(name = "ExpViaje.findByJugador", query = "SELECT e FROM ExpViaje e WHERE e.jugador = :jugador"),
		@NamedQuery(name = "ExpViaje.findByTipoCamino", query = "SELECT e FROM ExpViaje e WHERE e.tipoCamino = :tipoCamino"),
		@NamedQuery(name = "ExpViaje.findByKm", query = "SELECT e FROM ExpViaje e WHERE e.km = :km"),
		@NamedQuery(name = "ExpViaje.findByEstado", query = "SELECT e FROM ExpViaje e WHERE e.estado = :estado"),
		@NamedQuery(name = "ExpViaje.findByIdPartida", query = "SELECT e FROM ExpViaje e WHERE e.idPartida = :idPartida"),
		@NamedQuery(name = "ExpViaje.findByCompartido", query = "SELECT e FROM ExpViaje e WHERE e.compartido = :compartido")})
public class ExpViaje extends ExperienciaBase {
	private static final long serialVersionUID = 1L;

	@Basic(optional = false)
	@Column(name = "valor1")
	private int tipoCamino;
	@Basic(optional = false)
	@Column(name = "valor2")
	private int km;
	@Basic(optional = false)
	@Column(name = "valor3")
	private double estado;

	public ExpViaje() {
	}

	public ExpViaje(Integer id) {
		super(id);
	}

	public int getTipoCamino() {
		return tipoCamino;
	}

	public void setTipoCamino(int valor1) {
		this.tipoCamino = valor1;
	}

	public int getKm() {
		return km;
	}

	public void setKm(int valor2) {
		this.km = valor2;
	}

	public double getEstado() {
		return estado;
	}

	public void setEstado(double valor3) {
		this.estado = valor3;
	}

	@Override
	public void actualizaExp() {
		setExp((int) Math.ceil(getTipoCamino() * getKm() * getEstado()));
	}

	@Override
	public String toString() {
		return "org.rm.entidades.ExpViaje[id=" + super.getId() + "]";
	}
}
